/*
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:lib_basemodel/server_client/user.pb.dart';
import 'package:lib_baseview/lib_baseview.dart';
import 'package:lib_basemodel/server_client/message.pb.dart';
import 'package:m_chatroom/src/extensions/message_extension.dart';

///
/// 弹幕消息item控件 （普通的文字消息）
class BarrageItem extends StatelessWidget {
  final Message message;
  final Function? callBack;

  const BarrageItem({super.key, required this.message, this.callBack});

  SimpleUser get sender => message.sender;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(top: 10, bottom: 10),
      padding: const EdgeInsets.symmetric(vertical: 6,horizontal: 5),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          GestureDetector(
            onTap: () {
              callBack?.call(sender.id);
            },
            child: AvatarImage(
              url: sender.avatar ?? "",
              width: 30,
              height: 30,
              borderRadius: 15,
            ),
          ),
          const SizedBox(
            width: 6,
          ),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.min,
              children: [
                _getHeader(),
                const SizedBox(
                  height: 4,
                ),
                _getContent(),
              ],
            ),
          ),
        ],
      ),
    );
  }

  Widget _getHeader() {
    bool hasCar =
        sender.carIcon != null && sender.carIcon.isNotEmpty;
    return Row(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        //座驾
        Offstage(
          offstage: !hasCar,
          child: CachedNetworkImage(
            imageUrl: sender.carIcon ?? "",
            width: 24,
            height: 15,
            fit: BoxFit.fill,
            placeholder: (_, url) => Image.asset("assets/images/ic_small_car.png"),
            errorWidget: (_, url, err) => Image.asset("assets/images/ic_small_car.png"),
          ),
        ),
        //昵称
        ConstrainedBox(
          constraints: const BoxConstraints(maxWidth: 80),
          child: Text(
            sender.nickname ?? "",
            maxLines: 1,
            style: const TextStyle(
              color: Color.fromRGBO(185, 185, 185, 1),
              fontSize: 12,
              overflow: TextOverflow.ellipsis,
            ),
          ),
        ),
        const SizedBox(
          width: 6,
        ),
        //性别年龄
        SexAgeLabel(
          isMale: sender.gender == 'male',
          age: sender.age.toString() ?? "18",
        ),
        const SizedBox(
          width: 6,
        ),
        //等级
        UserLevWidget(
          vipLev: int.parse(sender.vipLevel.toString() ?? "1"),
        ),
      ],
    );
  }

  Widget _getContent() {
    return Container(
      decoration: const BoxDecoration(
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(12),
          bottomLeft: Radius.circular(12),
          bottomRight: Radius.circular(12),
        ),
        color: Color.fromRGBO(223, 214, 255, 0.09),
      ),
      padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
      child: Text(
        formatConversion(message),
        maxLines: 8,
        softWrap: true,
        overflow: TextOverflow.ellipsis,
        style: const TextStyle(
          color: Colors.white,
          fontSize: 12,
        ),
      ),
    );
  }

  String formatConversion(Message tmpMessage) => tmpMessage.msgContent.text;
}
*/
